// 封装本地存储的方法
const storage={
  set(key, value) {
      //对象必须序列化才能存入缓存
      localStorage.setItem(key, JSON.stringify(value));
  },
  get(key) {
          //反序列化
      if(localStorage.getItem(key)!==undefined){
          return JSON.parse(localStorage.getItem(key));
      }
  },
  remove(key) {
      localStorage.removeItem(key);
  }
}
export default storage